<template>
  <div style="background:#fff;padding:15px;margin:15px;">
    <el-link style="display:block;font-size:16px;margin-bottom:10px;" :underline="false" type="primary" v-for="item in linkList" :key="item.Title" @click="linkClick(item.Url)">{{ item.Title }}</el-link>
  </div>
</template>

<script>
import { connrequest, customsrequest } from '@/api/firstPage'
export default {
  data(){
    return {
      linkList: [],
      filterText: '',
      expanded: [],
      defaultProps: {
        children: 'Child',
        label: 'Title'
      }
    }
  },
  watch: {
    filterText(val) {
      this.$refs.tree.filter(val);
    }
  },
  created(){
    this.getData()
  },
  methods: {
    filterNode(value, data) {
      if (!value) return true;
      return data.Title.indexOf(value) !== -1;
    },
    append(data){
      console.log(data);
    },
    linkClick(Url){
      window.open(`${process.env.VUE_APP_BASE_API}${Url}`)
    },
    async getData(){
      const data = {
        Data:{
          FileName: '/school/config/docDir.json'
        }
      }
      const res = await connrequest('GetDetailFileContent', data)
      let array = JSON.parse(res.Data.Content);
      let routingTable = 
        {
          systemOverview: '系统概述',
          networkAcceleration: '网络加速',
          amazonAssistant: '亚马逊助手',
          smartMail: '智能邮件',
          artificialIntelligence: '人工智能',
          behavioralAudit: '行为审计',
          overseasLiveStreaming: '海外直播',
          preciseResources: '精准资源',
          otherFunctions: '其它功能',
        }
      let route = this.$route.name
      array.map(item => {
        if(item.Title === routingTable[route]){
          this.linkList = item.Child
        }
      })
    },
  }
}
</script>

<style>

</style>